package cn.dm.service;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import cn.dm.mapper.DmSchedulerSeatPriceMapper;
import cn.dm.pojo.DmSchedulerSeatPrice;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by zezhong.shang on 18-5-15.
 */
@RestController
public class RestDmSchedulerSeatPriceService {

    @Resource
    private DmSchedulerSeatPriceMapper dmSchedulerSeatPriceMapper;

    @RequestMapping(value = "/getDmSchedulerSeatPriceById", method = RequestMethod.POST)
    public DmSchedulerSeatPrice getDmSchedulerSeatPriceById(@RequestParam("id") Long id) throws Exception {
        return dmSchedulerSeatPriceMapper.getDmSchedulerSeatPriceById(id);
    }

    @RequestMapping(value = "/getDmSchedulerSeatPriceListByMap", method = RequestMethod.POST)
    public List<DmSchedulerSeatPrice> getDmSchedulerSeatPriceListByMap(@RequestBody Map<String, Object> param) throws Exception {
        return dmSchedulerSeatPriceMapper.getDmSchedulerSeatPriceListByMap(param);
    }

    @RequestMapping(value = "/getDmSchedulerSeatPriceCountByMap", method = RequestMethod.POST)
    public Integer getDmSchedulerSeatPriceCountByMap(@RequestBody Map<String, Object> param) throws Exception {
        return dmSchedulerSeatPriceMapper.getDmSchedulerSeatPriceCountByMap(param);
    }

    @RequestMapping(value = "/qdtxAddDmSchedulerSeatPrice", method = RequestMethod.POST)
    public Integer qdtxAddDmSchedulerSeatPrice(@RequestBody DmSchedulerSeatPrice dmSchedulerSeatPrice) throws Exception {
        dmSchedulerSeatPrice.setCreatedTime(new Date());
        return dmSchedulerSeatPriceMapper.insertDmSchedulerSeatPrice(dmSchedulerSeatPrice);
    }

    @RequestMapping(value = "/qdtxModifyDmSchedulerSeatPrice", method = RequestMethod.POST)
    public Integer qdtxModifyDmSchedulerSeatPrice(@RequestBody DmSchedulerSeatPrice dmSchedulerSeatPrice) throws Exception {
        dmSchedulerSeatPrice.setUpdatedTime(new Date());
        return dmSchedulerSeatPriceMapper.updateDmSchedulerSeatPrice(dmSchedulerSeatPrice);
    }

    @RequestMapping(value = "/getDmSchedulerSeatPriceBySchedulerIdAndArea", method = RequestMethod.POST)
    public DmSchedulerSeatPrice getDmSchedulerSeatPriceBySchedulerIdAndArea(@RequestParam("areaLevel") Integer areaLevel, @RequestParam("scheduleId") Long scheduleId) throws Exception {
        return dmSchedulerSeatPriceMapper.getDmSchedulerSeatPriceBySchedulerIdAndArea(areaLevel,scheduleId);
    }

}
